package Algorithm.LinkedListProblem;

/**
 * @Author cj
 * @Date 2021/11/21 10:33
 */
public class reverseDoubleList {

    class DoubleNode {
        public int value;
        public DoubleNode pre;
        public DoubleNode next;

        public DoubleNode(int val) {
            this.value = val;
        }
    }

    public static DoubleNode reverseDoubleList1(DoubleNode head) {
        DoubleNode pre = null;
        DoubleNode after = null;
        while (head != null) {
            after = head.next;
            head.next = pre;
            head.pre = after;
            pre = head;
            head = after;
        }
        return pre;
    }
}
